package com.weisy.signin.ui.activity;

import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.weisy.signin.R;
import com.weisy.signin.base.BaseAcativity;
import com.weisy.signin.bean.Plan;
import com.weisy.signin.comm.Comm;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * @author weisy
 * @function 日程详情
 * @date 2019/3/28 8:37
 */
@Route(path = Comm.ROUTE_PLAN_INFO)
public class PlanInfoActivity extends BaseAcativity {

    @BindView(R.id.txt_info_title)
    TextView txtTitle;
    @BindView(R.id.txt_info_time)
    TextView txtTime;
    @BindView(R.id.txt_info_local)
    TextView txtLocal;
    @BindView(R.id.txt_info_info)
    TextView txtInfo;

    @Autowired
    Plan plan;

    @Override
    public void findView() {
        setContentView(R.layout.activity_plan_info);
        ARouter.getInstance().inject(this);
    }

    @Override
    public void initView() {
        txtTitle.setText(plan.getTitle());
        if (!TextUtils.isEmpty(plan.getTime())) {
            txtTime.setText(String.format("时间：%s", plan.getTime()));
        } else {
            txtTime.setText(String.format("时间：%s", plan.getDate()));
        }
        txtLocal.setText(String.format("地点：%s", plan.getLocal()));
        txtInfo.setText(plan.getInfo());
    }

    @Override
    public void initData() {

    }

    @OnClick({R.id.img_add_close})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.img_add_close:
                finish();
                break;
        }
    }
}
